'I represent control for scrolling using an x-axis scroll bar. I am a subclass of ScrollController that creates an x-axis scroll bar. My subclasses then have x and y-axis
scroll bars. I keep control as long as the cursor is inside the view or either one of the scroll bars.
The y-axis scroll bar is a rectangular area representing the length of the information being viewed. It contains an inner rectangle whose top y-coordinate represents the relative position of the information visible on the screen with respect to all of the information, and whose size represents the relative amount of that information visible on the screen. The user controls which part of the information is visible by pressing the red button. If the cursor is to the right of the inner rectangle, the windo
w onto the visible information moves upward, if the cursor is to the left, the window moves downward, and if the cursor is inside, the inner rectangle is grabbed and moved to a desired position. The x-axis scroll bar is controlled in an analogous manner.
Instance Variables:
xScrollBar <Quadrangle> inside white, the outer rectangle
xMarker <Quadrangle> inside gray, the inner rectangle
xSavedArea <Form> the area the xScrollBar overlaps, restored whenever
'As a subclass of XAxisScrollController I provide X and Y axis scrolling. In addition, I provide ''smooth'' scrolling by red button dragging of the mouse. I also am capable of responding to red button clicks to select an element of the display if I have a menu to activate for selections. The menu is initialized by my selectionMenu: message which takes an ActionMenu as its argument. The message selectors included with the ActionMenu must be messages that the objects which make up the graph respond to.
My instance variables:
scrollBox <Rectangle>
My scrollBox represents the area of the display which
is visible on the screen. It is in local view coordinates.
selection <GraphNode>
If an element of the display has been selected by clicking
the mouse red button on it, it is saved here.
selectionMenu <Array of (PopUpMenu, Array of message selectors)>
The yellow button menu to be activated when a selection
has been made and the yellow button is pressed. Menu
messages are sent to the object field of the selected
GraphNode. If selectionMenu is nil the window does not
respond to red button clicks (although red button scrolling
!GraphHolderController class methodsFor: 'class initialization'!
initialize
"GraphHolderController initialize."
YellowButtonMenu _ ActionMenu
labels: 'file out' withCRs
selectors: #( #fileOutGraph )! !
GraphHolderController initialize!
View subclass: #GraphHolderView
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Grapher'!
GraphHolderView comment:
'I provide a resizable View on graphical objects, without scaling the object. To do this I maintain the standard cooridinate transformations of View, but I use only a transformation with unit scaling for display purposes.
Used as a subview of a StandardSystemView, I should be added via the addSubView:in:borderWidth: message to ensure proper rescaling during a resize operation.